package cn.itcast.hotel.controll;

import cn.itcast.hotel.pojo.PageResult;
import cn.itcast.hotel.pojo.RequestParams;
import cn.itcast.hotel.service.IHotelService;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @Author: 生如夏花
 * @Date: 2022/3/9 19:26
 */
@RestController
public class HotelController {
    @Autowired
    private RestHighLevelClient client;

    @Autowired
    private IHotelService hotelService;
    @PostMapping("/hotel/list")
    public PageResult queryHotels(@RequestBody RequestParams param){
        return hotelService.queryHotels(param);
    }

    @PostMapping("/hotel/filters")
    public Map<String, List<String>> filters(@RequestBody RequestParams param){
        return hotelService.filters (param);
    }
    @GetMapping("hotel/suggestion")
    public List<String> suggestion(@RequestParam String key){
        return hotelService.suggestion(key);
    }

}
